package cn.good.biz.service;

import cn.good.pojo.Comment;
import cn.good.pojo.Doctor;
import cn.good.service.DoctorService;
import cn.good.vo.DoctorInfoVO;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class GDDoctorServiceImpl implements GDDoctorService{

    @Reference
    private DoctorService doctorService;

    /**
     * 查询医生信息
     * @param id
     */
    @Override
    public DoctorInfoVO searchDoctorInfo(Long id) {

        doctorService.searchServicePriceByDoctorId(id);

        DoctorInfoVO doctorInfoVO = doctorService.selectInfoById(id);

        doctorInfoVO.setList(doctorService.searchServicePriceByDoctorId(id));

        return doctorInfoVO;
    }
    /**
     * 关注医生
     * @param userId
     * @param doctorId
     * @return
     */
    @Override
    public void attentionDoctor(Long userId, Long doctorId) throws Exception{
        doctorService.insertAtention(userId,doctorId);
    }

    /**
     * 取关医生
     * @param userId
     * @param doctorId
     */
    @Override
    public void cancelDoctor(Long userId, Long doctorId) {
        doctorService.updateAtention(userId,doctorId);
    }

    /**
     * 查询关注的医生列表
     * @param userId
     * @return
     */
    @Override
    public List<Doctor> selectDoctorListByUserId(Long userId) {

        return doctorService.searchDoctorByUserId(userId);
    }

    @Override
    public List<Comment> selectCommonListByUesrDoctorId(Long doctorId) throws Exception {
        return doctorService.searchCommentByDoctorId(doctorId);
    }
}
